<template>
  <div class="app-container">
    <el-row style="margin-top:20px;font-size:14px;color:#666">
      <el-col :span="2">客户：111</el-col>
    

    </el-row>

    <el-table :key="tableKey" v-loading="listLoading" :data="list" :row-class-name="tableRowClassName" border fit highlight-current-row style="width: 100%;margin-top:20px">

      <el-table-column label="还款期数" align="center" width="50px">
        <template slot-scope="{row}">
          <span>{{ row.qs }}</span>
        </template>
      </el-table-column>
      <el-table-column label="应还时间" align="center" width="100px">
        <template slot-scope="{row}">
          <span>{{ row.time_date }}</span>
        </template>
      </el-table-column>

      <!-- <el-table-column label="实际还款时间" align="center" width="110px">
          <template slot-scope="{row}">
            <span>{{ row.sh_time }}</span>
          </template>
        </el-table-column> -->
      <el-table-column label="还款状态" align="center" width="80px">
        <template slot-scope="{row}">
          <span>{{ row.status_name }}</span>
        </template>
      </el-table-column>
      <el-table-column label="还款金额" align="center" width="80px">
        <template slot-scope="{row}">
          <span>{{ row.total_money }}</span>
        </template>
      </el-table-column>
      <el-table-column label="本金" align="center" width="80px">
        <template slot-scope="{row}">
          <span>{{ row.money }}</span>
        </template>
      </el-table-column>
      <el-table-column label="利息" align="center" width="110px">
        <template slot-scope="{row}">
          <div class="input-box">
            <el-input v-model="row.money_rate" size="small" prop="money_rate" :disabled="row.is_paid==1?true:false" />
          </div>
        </template>
      </el-table-column>
      <el-table-column label="滞纳金" align="center" width="80px">
        <!-- <template slot-scope="{row}">
          <div class="input-box">
            <el-input v-model="row.late_fee" size="small" prop="late_fee" :disabled="row.is_paid==1?true:false" />
          </div>
        </template> -->
        <template slot-scope="{row}">
          <span>{{ row.late_fee }}</span>
        </template>
      </el-table-column>
      <el-table-column label="实际还款额" align="center" width="110px">
        <template slot-scope="{row}">
          <div class="input-box">
            <el-input v-model="row.paid_money" size="small" prop="paid_money" :disabled="row.is_paid==1?true:false" />
          </div>
        </template>
      </el-table-column>
      <el-table-column label="实际还款日期" align="center" width="130px">
        <template slot-scope="{row}">
          <div v-if="row.is_paid!=1 && row.paid_money!=0" class="block">
            <el-date-picker
              v-model="value2"
              style="width:140px"
              format="yyyy-MM-dd"
              type="datetime"
              placeholder="选择日期"
            />
          </div>
          <span v-if="row.is_paid==1">{{ row.paid_date }}</span>
        </template>
      </el-table-column>
      <el-table-column label="还款方式" align="center" width="130px">
        <template slot-scope="{row}">
            <el-select v-model="row.payway" placeholder="请选择" :disabled="row.is_paid==1?true:false">
            <el-option
              v-for="item in payway"
              :key="item.id"
              :label="item.name"
              :value="item.id">
            </el-option>
          </el-select>
        </template>
      </el-table-column>
      <el-table-column label="是否已还" align="center" width="100px">
        <template slot-scope="{row}">
           <el-select v-model="row.is_paid_bf" placeholder="请选择" :disabled="row.is_paid==1?true:false">
            <el-option
              v-for="item in paid_options"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </template>
      </el-table-column>
      <el-table-column label="本金回款" align="center" width="90px">
        <template slot-scope="{row}">
          <span>{{ row.benjin }}</span>
        </template>
      </el-table-column>
      <!-- <el-table-column label="是否结算" align="center" width="50px">
        <template slot-scope="{row}">
          <span>{{ row.settle_name }}</span>
        </template>
      </el-table-column> -->
      <el-table-column label="是否结算" align="center" width="80px">
        <template slot-scope="{row}">
           <el-select v-model="row.is_settle" placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </template>
      </el-table-column>
      <el-table-column label="结算金额" align="center" width="110px">
        <template slot-scope="{row}">
          <div class="input-box">
            <el-input v-model="row.settle_money" size="small" prop="settle_money"  />
          </div>
        </template>
      </el-table-column>
      <el-table-column label="结算时间" align="center" width="150px">
        <template slot-scope="{row}">
          <div v-if="row.is_paid!=0&&row.settle_day==null" class="block">
            <el-date-picker
              v-model="value1"
              style="width:140px"
              format="yyyy-MM-dd"
              type="datetime"
              placeholder="选择日期"
            />
          </div>
          <div v-if="row.is_paid!=0&&row.settle_day!=null" class="block">
            <el-date-picker
              v-model="row.settle_day"
              style="width:140px"
              format="yyyy-MM-dd"
              type="datetime"
              placeholder="选择日期"
            />
          </div>
          <!-- <span v-if="row.settle_day!=''">{{ row.settle_day }}</span> -->
        </template>
      </el-table-column>

      <el-table-column label="操作" align="center" width="100" class-name="small-padding fixed-width">
        <template slot-scope="{row,$index}">
          <el-button  type="primary" size="mini" @click="onSubmit(row)">
            保存
          </el-button>
          <!-- <el-button v-if="row.can_bond==1&&row.is_paid==1" type="error" size="mini" @click="toBond(row)">
            转为保证金
          </el-button> -->
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import {
  haierPaymentList
} from '@/api/finance'
import waves from '@/directive/waves' // waves directive
import {
  parseTime
} from '@/utils'
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
export default {
  name: 'ComplexTable',
  components: {
    Pagination
  },
  directives: {
    waves
  },
  filters: {},
  data() {
    return {
      tableKey: 0,
      tableRecord: 1,
      list: null,
      payway:[],
      order: [],
     
      project: '',
      record_list: null,
      listRecordLoading: true,
      recordTotal: 0,
      total: 0,
      listLoading: true,
      query: {
        order_id: ''
      },
    }
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      this.query.order_id = this.$route.params.order_id
      haierPaymentList(this.query).then(response => {
        this.list = response.data.list
        this.order = response.data.order
        this.project = response.data.project
        this.listLoading = false
      })
    }
  }
}
</script>
<style>
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
  }
  select{
    width:100px;
  }
  .el-table .warning-row {
      background: orangered;
    }

  .el-table .success-row {
    background: #98dd72;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .tb-edit .input-box {
    display: none
  }
  .tb-edit .current-cell .input-box {
    display: block;
    margin-left: -15px;
  }

  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }

  .avatar {
    width: 178px;
    height: 178px;
    display: block;
    float: left;
  }
</style>
